package com.portal4kids.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "people")
public class People implements Serializable{
	private static final long serialVersionUID = 1866357502189675701L;
	
	private int id_people;
	private String firstname = "none";
	private String surname = "none";
	private int phone = -1;
	private String mail = "none";
	private String adress = "none";
	private String login = "none";
	private String password = "none";
	private String type = "none";
	private String description = "none";
	private int rating = 0;
	private int avarage = 0;
	private int numberOfVotes = 0;
	private String comments = "none";
	private List<PeopleAttributes> attributes;
	private List<PeopleVisitPlan> visitPlan;
	
	
	@Id
    @GeneratedValue
	public int getId_people() {
		return id_people;
	}
	public void setId_people(int id_people) {
		this.id_people = id_people;
	}
	
	@OneToMany(cascade={CascadeType.ALL})
	@JoinColumn(name="id_attributes")
	public List<PeopleAttributes> getAttributes() {
		return attributes;
	}
	public void setAttributes(List<PeopleAttributes> attributes) {
		this.attributes = attributes;
	}
	
	@OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER)
	@JoinColumn(name="id_plan")
	public List<PeopleVisitPlan> getVisitPlan() {
		return visitPlan;
	}
	public void setVisitPlan(List<PeopleVisitPlan> visitPlan) {
		this.visitPlan = visitPlan;
	}
	public String getFirstname() {
		return firstname;
	}
	public void setFirstname(String firstname) {
		if(!firstname.isEmpty())
			this.firstname = firstname;
	}
	public String getSurname() {
		return surname;
	}
	public void setSurname(String surname) {
		if(!surname.isEmpty())
			this.surname = surname;
	}
	public int getPhone() {
		return phone;
	}
	public void setPhone(int phone) {
		if(phone > 0)
			this.phone = phone;
	}
	public String getMail() {
		return mail;
	}
	public void setMail(String mail) {
		if(!mail.isEmpty())
			this.mail = mail;
	}
	public String getAdress() {
		return adress;
	}
	public void setAdress(String adress) {
		if(!adress.isEmpty())
			this.adress = adress;
	}
	public String getLogin() {
		return login;
	}
	public void setLogin(String login) {
		if(!login.isEmpty())
			this.login = login;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		if(!password.isEmpty())
			this.password = password;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		if(!type.isEmpty())
			this.type = type;
	}
	@Column(name="description", length=10000)
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		if(!description.isEmpty())
			this.description = description;
	}
	public int getRating() {
		return rating;
	}
	public void setRating(int rating) {
		this.rating = rating;
	}
	public int getAvarage() {
		return avarage;
	}
	public void setAvarage(int avarage) {
		this.avarage = avarage;
	}
	public int getNumberOfVotes() {
		return numberOfVotes;
	}
	public void setNumberOfVotes(int numberOfVotes) {
		this.numberOfVotes = numberOfVotes;
	}
	public String getComments() {
		return comments;
	}
	public void setComments(String comments) {
		this.comments = comments;
	}
	
	
	
	
	
}
